package com.gxa.autoparts.admin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author Bei
 * @date 2022/1/10 17:44
 */
@Controller
@RequestMapping("/session")
public class SessionController {


        @PostMapping("/count")
        @ResponseBody
        public String count(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
            HttpSession session = httpServletRequest.getSession();
            Object count=session.getServletContext().getAttribute("count");
            return "count : "+count;
        }



}
